package main

// 维吉尼亚算法
import "fmt"

// 加密秘钥
var keyWord []byte = []byte("GOLANG")

// 解密篮本
var rootDic map[byte]uint8 = make(map[byte]uint8, 26)

// 解密密码本
var pwdDic map[rune]byte

func main() {
	// 得到解密篮本
	getRootDic()
	fmt.Println(rootDic)

	var str = "hello world"
	getPwdDic(str)
	fmt.Println(pwdDic)

}

func getPwdDic(decryStr string) {
	pwdDic = make(map[rune]byte, len(decryStr))

	index := 0
	for _, v := range decryStr {
		if index > len(keyWord) {
			index = 0
		}
		pwdDic[v] = keyWord[index]
		index++
	}
}

func getRootDic() {
	rootStr := "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
	for i, v := range rootStr {
		rootDic[byte(v)] = uint8(i)
	}
}

func decry() {

}
